# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.AuthorizedBuyersMarketplace.V1.Model.Deal do
  @moduledoc """
  A deal represents a segment of inventory for displaying ads that contains the terms and targeting information that is used for serving as well as the deal stats and status. Note: A proposal may contain multiple deals.

  ## Attributes

  *   `billedBuyer` (*type:* `String.t`, *default:* `nil`) - Output only. When the client field is populated, this field refers to the buyer who creates and manages the client buyer and gets billed on behalf of the client buyer; when the buyer field is populated, this field is the same value as buyer; when the deal belongs to a media planner account, this field will be empty. Format : `buyers/{buyerAccountId}`
  *   `buyer` (*type:* `String.t`, *default:* `nil`) - Output only. Refers to a buyer in Real-time Bidding API's Buyer resource. Format: `buyers/{buyerAccountId}`
  *   `buyerPermissionType` (*type:* `String.t`, *default:* `nil`) - Output only. The buyer permission type of the deal.
  *   `client` (*type:* `String.t`, *default:* `nil`) - Output only. Refers to a Client. Format: `buyers/{buyerAccountId}/clients/{clientAccountid}`
  *   `createTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. The time of the deal creation.
  *   `creativeRequirements` (*type:* `GoogleApi.AuthorizedBuyersMarketplace.V1.Model.CreativeRequirements.t`, *default:* `nil`) - Output only. Metadata about the creatives of this deal.
  *   `dealType` (*type:* `String.t`, *default:* `nil`) - Output only. Type of deal.
  *   `deliveryControl` (*type:* `GoogleApi.AuthorizedBuyersMarketplace.V1.Model.DeliveryControl.t`, *default:* `nil`) - Output only. Specifies the pacing set by the publisher.
  *   `description` (*type:* `String.t`, *default:* `nil`) - Output only. Free text description for the deal terms.
  *   `displayName` (*type:* `String.t`, *default:* `nil`) - Output only. The name of the deal. Maximum length of 255 unicode characters is allowed. Control characters are not allowed. Buyers cannot update this field. Note: Not to be confused with name, which is a unique identifier of the deal.
  *   `eligibleSeatIds` (*type:* `list(String.t)`, *default:* `nil`) - Output only. If set, this field contains the list of DSP specific seat ids set by media planners that are eligible to transact on this deal. The seat ID is in the calling DSP's namespace.
  *   `estimatedGrossSpend` (*type:* `GoogleApi.AuthorizedBuyersMarketplace.V1.Model.Money.t`, *default:* `nil`) - Specified by buyers in request for proposal (RFP) to notify publisher the total estimated spend for the proposal. Publishers will receive this information and send back proposed deals accordingly.
  *   `flightEndTime` (*type:* `DateTime.t`, *default:* `nil`) - Proposed flight end time of the deal. This will generally be stored in a granularity of a second. A value is not necessary for Private Auction deals.
  *   `flightStartTime` (*type:* `DateTime.t`, *default:* `nil`) - Proposed flight start time of the deal. This will generally be stored in the granularity of one second since deal serving starts at seconds boundary. Any time specified with more granularity (for example, in milliseconds) will be truncated towards the start of time in seconds.
  *   `mediaPlanner` (*type:* `GoogleApi.AuthorizedBuyersMarketplace.V1.Model.MediaPlanner.t`, *default:* `nil`) - Output only. Refers to a buyer in Real-time Bidding API's Buyer resource. This field represents a media planner (For example, agency or big advertiser).
  *   `name` (*type:* `String.t`, *default:* `nil`) - Immutable. The unique identifier of the deal. Auto-generated by the server when a deal is created. Format: buyers/{accountId}/proposals/{proposalId}/deals/{dealId}
  *   `preferredDealTerms` (*type:* `GoogleApi.AuthorizedBuyersMarketplace.V1.Model.PreferredDealTerms.t`, *default:* `nil`) - The terms for preferred deals.
  *   `privateAuctionTerms` (*type:* `GoogleApi.AuthorizedBuyersMarketplace.V1.Model.PrivateAuctionTerms.t`, *default:* `nil`) - The terms for private auction deals.
  *   `programmaticGuaranteedTerms` (*type:* `GoogleApi.AuthorizedBuyersMarketplace.V1.Model.ProgrammaticGuaranteedTerms.t`, *default:* `nil`) - The terms for programmatic guaranteed deals.
  *   `proposalRevision` (*type:* `String.t`, *default:* `nil`) - Output only. The revision number for the proposal and is the same value as proposal.proposal_revision. Each update to deal causes the proposal revision number to auto-increment. The buyer keeps track of the last revision number they know of and pass it in when making an update. If the head revision number on the server has since incremented, then an ABORTED error is returned during the update operation to let the buyer know that a subsequent update was made.
  *   `publisherProfile` (*type:* `String.t`, *default:* `nil`) - Immutable. Reference to the seller on the deal. Format: `buyers/{buyerAccountId}/publisherProfiles/{publisherProfileId}`
  *   `sellerTimeZone` (*type:* `GoogleApi.AuthorizedBuyersMarketplace.V1.Model.TimeZone.t`, *default:* `nil`) - Output only. Time zone of the seller used to mark the boundaries of a day for daypart targeting and CPD billing.
  *   `targeting` (*type:* `GoogleApi.AuthorizedBuyersMarketplace.V1.Model.MarketplaceTargeting.t`, *default:* `nil`) - Specifies the subset of inventory targeted by the deal. Can be updated by the buyer before the deal is finalized.
  *   `updateTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. The time when the deal was last updated.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :billedBuyer => String.t() | nil,
          :buyer => String.t() | nil,
          :buyerPermissionType => String.t() | nil,
          :client => String.t() | nil,
          :createTime => DateTime.t() | nil,
          :creativeRequirements =>
            GoogleApi.AuthorizedBuyersMarketplace.V1.Model.CreativeRequirements.t() | nil,
          :dealType => String.t() | nil,
          :deliveryControl =>
            GoogleApi.AuthorizedBuyersMarketplace.V1.Model.DeliveryControl.t() | nil,
          :description => String.t() | nil,
          :displayName => String.t() | nil,
          :eligibleSeatIds => list(String.t()) | nil,
          :estimatedGrossSpend => GoogleApi.AuthorizedBuyersMarketplace.V1.Model.Money.t() | nil,
          :flightEndTime => DateTime.t() | nil,
          :flightStartTime => DateTime.t() | nil,
          :mediaPlanner => GoogleApi.AuthorizedBuyersMarketplace.V1.Model.MediaPlanner.t() | nil,
          :name => String.t() | nil,
          :preferredDealTerms =>
            GoogleApi.AuthorizedBuyersMarketplace.V1.Model.PreferredDealTerms.t() | nil,
          :privateAuctionTerms =>
            GoogleApi.AuthorizedBuyersMarketplace.V1.Model.PrivateAuctionTerms.t() | nil,
          :programmaticGuaranteedTerms =>
            GoogleApi.AuthorizedBuyersMarketplace.V1.Model.ProgrammaticGuaranteedTerms.t() | nil,
          :proposalRevision => String.t() | nil,
          :publisherProfile => String.t() | nil,
          :sellerTimeZone => GoogleApi.AuthorizedBuyersMarketplace.V1.Model.TimeZone.t() | nil,
          :targeting =>
            GoogleApi.AuthorizedBuyersMarketplace.V1.Model.MarketplaceTargeting.t() | nil,
          :updateTime => DateTime.t() | nil
        }

  field(:billedBuyer)
  field(:buyer)
  field(:buyerPermissionType)
  field(:client)
  field(:createTime, as: DateTime)

  field(:creativeRequirements,
    as: GoogleApi.AuthorizedBuyersMarketplace.V1.Model.CreativeRequirements
  )

  field(:dealType)
  field(:deliveryControl, as: GoogleApi.AuthorizedBuyersMarketplace.V1.Model.DeliveryControl)
  field(:description)
  field(:displayName)
  field(:eligibleSeatIds, type: :list)
  field(:estimatedGrossSpend, as: GoogleApi.AuthorizedBuyersMarketplace.V1.Model.Money)
  field(:flightEndTime, as: DateTime)
  field(:flightStartTime, as: DateTime)
  field(:mediaPlanner, as: GoogleApi.AuthorizedBuyersMarketplace.V1.Model.MediaPlanner)
  field(:name)

  field(:preferredDealTerms, as: GoogleApi.AuthorizedBuyersMarketplace.V1.Model.PreferredDealTerms)

  field(:privateAuctionTerms,
    as: GoogleApi.AuthorizedBuyersMarketplace.V1.Model.PrivateAuctionTerms
  )

  field(:programmaticGuaranteedTerms,
    as: GoogleApi.AuthorizedBuyersMarketplace.V1.Model.ProgrammaticGuaranteedTerms
  )

  field(:proposalRevision)
  field(:publisherProfile)
  field(:sellerTimeZone, as: GoogleApi.AuthorizedBuyersMarketplace.V1.Model.TimeZone)
  field(:targeting, as: GoogleApi.AuthorizedBuyersMarketplace.V1.Model.MarketplaceTargeting)
  field(:updateTime, as: DateTime)
end

defimpl Poison.Decoder, for: GoogleApi.AuthorizedBuyersMarketplace.V1.Model.Deal do
  def decode(value, options) do
    GoogleApi.AuthorizedBuyersMarketplace.V1.Model.Deal.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.AuthorizedBuyersMarketplace.V1.Model.Deal do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
